package com.aspose.cells.a.d;

import java.util.ArrayList;
import java.util.HashMap;

public class zfq {
   private static float F = 96.0F;
   private static float G = 0.0F;
   private static Object H = new Object();
   private static Object I = new Object();
   private zap J;
   protected String a;
   protected String b;
   protected String c;
   protected String d;
   protected String e;
   protected zfv f;
   protected int g;
   protected int h;
   protected int i;
   protected int j;
   protected int k;
   protected int l;
   protected int m;
   protected int n;
   protected int o;
   protected int p;
   protected int q;
   protected int r;
   protected int s;
   protected int t;
   protected int u;
   protected int v;
   protected float w;
   protected int x;
   protected int y;
   protected zfx z;
   protected zfx A;
   protected zbc B;
   protected boolean C;
   protected zbf D;
   private boolean K;
   private boolean L = false;
   private zaa M;
   private boolean N;
   private boolean O;
   public ArrayList E = new ArrayList();
   private static HashMap P = new HashMap();
   private static HashMap Q = new HashMap();

   public zfq() {
      if (G == 0.0F) {
         Object var1 = H;
         synchronized(H) {
            if (G == 0.0F) {
               G = A();
            }
         }
      }

   }

   private static float A() {
      try {
         com.aspose.cells.b.a.b.za var0 = new com.aspose.cells.b.a.b.za(1, 1);

         float var2;
         try {
            com.aspose.cells.b.a.b.zi var1 = com.aspose.cells.b.a.b.zi.a((com.aspose.cells.b.a.b.zj)var0);

            try {
               var2 = var1.f();
            } finally {
               if (var1 != null) {
                  var1.d();
               }

            }
         } finally {
            if (var0 != null) {
               var0.b();
            }

         }

         return var2;
      } catch (Exception var13) {
         return F;
      }
   }

   public static float a() {
      if (G == 0.0F) {
         Object var0 = H;
         synchronized(H) {
            if (G == 0.0F) {
               G = A();
            }
         }
      }

      return G;
   }

   public String b() {
      return this.a;
   }

   public void a(String var1) {
      this.a = var1;
   }

   public void b(String var1) {
      this.b = var1;
   }

   public String c() {
      return this.c;
   }

   public void c(String var1) {
      this.c = var1;
   }

   public String d() {
      return this.d;
   }

   public void d(String var1) {
      this.d = var1;
   }

   public String e() {
      return this.e;
   }

   public void e(String var1) {
      this.e = var1;
   }

   public zfv f() {
      return this.f;
   }

   public void a(zfv var1) {
      this.f = var1;
   }

   public int g() {
      return this.g;
   }

   public void a(int var1) {
      this.g = var1;
   }

   public int h() {
      return this.h;
   }

   public void b(int var1) {
      this.h = var1;
   }

   public int i() {
      return this.i;
   }

   public void c(int var1) {
      this.i = var1;
   }

   public int j() {
      return this.j;
   }

   public void d(int var1) {
      this.j = var1;
   }

   public int k() {
      return this.i + this.j;
   }

   public int l() {
      return this.k;
   }

   public void e(int var1) {
      this.k = var1;
   }

   public float a(float var1) {
      if (this.l() != 0) {
         return this.a((float)this.l(), var1);
      } else if (this.q() - this.o() > 0) {
         return this.a((float)(this.q() - this.o()), var1);
      } else {
         return this.y() > 0 ? this.a((float)this.y(), var1) : var1;
      }
   }

   public void f(int var1) {
      this.l = var1;
   }

   public float b(float var1) {
      return this.a((float)this.j(), var1);
   }

   public void g(int var1) {
      this.n = var1;
   }

   public void h(int var1) {
      this.o = var1;
   }

   public void i(int var1) {
      this.p = var1;
   }

   public void j(int var1) {
      this.q = var1;
   }

   public void k(int var1) {
      this.m = var1;
   }

   public int m() {
      return this.r;
   }

   public void l(int var1) {
      this.r = var1;
   }

   public zaa n() {
      return this.M;
   }

   public void a(zaa var1) {
      this.M = var1;
   }

   public int o() {
      return this.s;
   }

   public void m(int var1) {
      this.s = var1;
   }

   public int p() {
      return this.t;
   }

   public void n(int var1) {
      this.t = var1;
   }

   public int q() {
      return this.u;
   }

   public void o(int var1) {
      this.u = var1;
   }

   public int r() {
      return this.v;
   }

   public void p(int var1) {
      this.v = var1;
   }

   public float s() {
      return this.w;
   }

   public void c(float var1) {
      this.w = var1;
   }

   public int a(char var1) {
      return this.f.b(var1).b();
   }

   public int f(String var1) {
      int var2 = 0;

      for(int var3 = 0; var3 < var1.length(); ++var3) {
         zfu var4 = this.f.b(var1.charAt(var3));
         var2 += var4.c();
      }

      return var2;
   }

   public float a(char var1, float var2) {
      zfu var3 = this.f.b(var1);
      return (float)var3.c() * var2 / (float)this.h() * G / 72.0F;
   }

   public float b(char var1, float var2) throws Exception {
      byte var3 = 96;
      int var4 = (int)((var2 * 20.0F * (float)var3 + 720.0F) / 1440.0F);
      var4 = ~var4 + 1;
      zah var5 = this.a(-var4, var1, (int)var2);
      return (float)var5.i * G / F;
   }

   public float a(String var1, float var2) throws Exception {
      int var3 = this.b(var1, var2);
      return (float)var3 / G * 72.0F;
   }

   public int b(String var1, float var2) throws Exception {
      byte var3 = 96;
      int var4 = (int)((var2 * 20.0F * (float)var3 + 720.0F) / 1440.0F);
      var4 = ~var4 + 1;
      int var5 = 0;

      for(int var6 = 0; var6 < var1.length(); ++var6) {
         char var7 = var1.charAt(var6);
         zah var8 = this.a(-var4, var7, (int)var2);
         var5 += var8.i;
      }

      return (int)((double)((float)var5 * G / F) + 0.5D);
   }

   public float c(String var1, float var2) {
      return this.a((float)this.f(var1), var2);
   }

   public float a(float var1, float var2) {
      float var3 = (float)this.h() / var2;
      return var1 / var3;
   }

   public zap t() {
      return this.J;
   }

   public void a(zap var1) {
      this.J = var1;
   }

   public int u() {
      return this.x;
   }

   public void q(int var1) {
      this.x = var1;
   }

   public void r(int var1) {
      this.y = var1;
   }

   public void a(zbf var1) {
      this.D = var1;
   }

   public zbc v() {
      return this.B;
   }

   public void a(zbc var1) {
      this.B = var1;
   }

   public void a(boolean var1) {
      this.C = var1;
   }

   public void a(zfx var1) {
      this.z = var1;
   }

   public void b(zfx var1) {
      this.A = var1;
   }

   public boolean w() {
      return this.K;
   }

   public void b(boolean var1) {
      this.K = var1;
   }

   public zah a(int var1, char var2, int var3) throws Exception {
      zah var4 = new zah();
      int var5 = var1;
      int var6 = var1;
      if (var1 >= 65535) {
         var5 = 65535;
      }

      if (var1 >= 65535) {
         var6 = 65535;
      }

      var5 <<= 6;
      var6 <<= 6;
      int var8;
      int var7 = var8 = this.h();
      var4.c = zan.b(var5, var7);
      var4.d = zan.b(var6, var8);
      var4.a = var5 + 32 >> 6;
      var4.b = var6 + 32 >> 6;
      var4.e = zan.c(zan.a(this.i(), var4.d));
      var4.f = zan.a(zan.a(-this.j(), var4.d));
      var4.g = zan.b(zan.a(this.k(), var4.d));
      var4.h = zan.b(zan.a(this.u(), var4.c));
      int var11 = this.a(var2);
      int var13 = a(var11, var1, this.v());
      int var12;
      if (var13 > 0) {
         var12 = var13 << 6;
         var12 = zan.b(var12);
         var4.i = var12 + 63 >> 6;
      } else {
         zfu var14 = this.f().b(var2);
         var12 = var14.c();
         var12 = zan.a(var12, var4.c);
         var12 = zan.b(var12);
         var4.i = var12 + 63 >> 6;
         byte[] var15 = this.a(this.b(), var3, this.g());
         if (var15 != null && var15.length > 0 && var2 <= 127 && var2 >= ' ') {
            int var16 = var15[(var3 - 2) * 96 + var2 - 32] & 255;
            if (var16 > 128) {
               var16 -= 256;
            }

            var4.i += var16;
         }
      }

      var4.e = var4.e + 32 >> 6;
      var4.f = Math.abs(var4.f) + 32 >> 6;
      var4.g = var4.e + var4.f + 1;
      return var4;
   }

   public static com.aspose.cells.b.a.b.zs a(String var0, float var1, String var2, int var3) throws Exception {
      byte var4 = 96;
      int var5 = (int)((var1 * 20.0F * (float)var4 + 720.0F) / 1440.0F);
      var5 = ~var5 + 1;
      zfq var6 = zfs.b(var0, var3, false);
      com.aspose.cells.b.a.b.zs var7 = new com.aspose.cells.b.a.b.zs();

      for(int var8 = 0; var8 < var2.length(); ++var8) {
         char var9 = var2.charAt(var8);
         zah var10 = var6.a(-var5, var9, (int)var1);
         var7.a(var7.b() + var10.i);
         byte var11 = -1;
         int[] var12 = new int[]{var11};
         boolean var13 = var6.a(var6.b(), (int)var1, var3, var12);
         int var14 = var12[0];
         if (var13) {
            var10.g = var14;
         } else {
            var10.g = (int)((double)(var6.a(var1) * F / 72.0F) + 0.5D);
         }

         if (var7.c() < var10.g) {
            var7.b(var10.g);
         }
      }

      var7.a((int)((double)((float)var7.b() * G / F) + 0.5D));
      var7.b((int)((double)((float)var7.c() * G / F) + 0.5D));
      return var7;
   }

   public boolean a(String var1, int var2, int var3, int[] var4) throws Exception {
      if (var2 >= 2 && var2 <= 33) {
         String var5 = var1 + var2 + var3;
         Object var6 = I;
         synchronized(I) {
            Object var7 = P.get(var5);
            if (var7 == null) {
               com.aspose.cells.a.f.zh var8 = zfs.f.a(var1 + ".dat");
               if (var8 == null) {
                  P.put(var5, -1);
                  return false;
               }

               com.aspose.cells.b.a.d.za var9 = new com.aspose.cells.b.a.d.za(zfs.f.a(var8));
               byte var10 = 0;
               if ((var3 & 1) != 0) {
                  var10 = 32;
               }

               byte[] var11 = var9.g(64);
               var9.l();
               var4[0] = var11[var2 + var10 - 2] & 255;
               P.put(var1 + var2 + var3, var4[0]);
            } else {
               if ((Integer)var7 == -1) {
                  return false;
               }

               var4[0] = (Integer)P.get(var5);
            }

            return true;
         }
      } else {
         return false;
      }
   }

   public byte[] a(String var1, int var2, int var3) throws Exception {
      if (var2 >= 2 && var2 <= 33) {
         if (var3 == 0) {
            var1 = var1 + "_Regular.diff";
         } else if (var3 == 1) {
            var1 = var1 + "_Bold.diff";
         } else if (var3 == 2) {
            var1 = var1 + "_Bold.diff";
         } else if (var3 == 3) {
            var1 = var1 + "_Bold, Italic.diff";
         }

         Object var5 = null;
         Object var6 = I;
         synchronized(I) {
            byte[] var11;
            if (Q.get(var1) == null) {
               com.aspose.cells.a.f.zh var7 = zfs.f.a(var1);
               if (var7 == null) {
                  var11 = new byte[0];
                  Q.put(var1, var11);
                  return var11;
               }

               com.aspose.cells.b.a.d.za var8 = new com.aspose.cells.b.a.d.za(zfs.f.a(var7));
               var11 = new byte[(int)var7.a()];
               var8.a(var11, 0, var11.length);
               var8.l();
               Q.put(var1, var11);
            } else {
               var11 = (byte[])((byte[])Q.get(var1));
            }

            return var11;
         }
      } else {
         return null;
      }
   }

   private static int a(int var0, int var1, zbc var2) {
      if (var2.d != null && var2.d.length > 0) {
         zak[] var3 = var2.d;
         int var4 = var3.length;

         for(int var5 = 0; var5 < var4; ++var5) {
            zak var6 = var3[var5];
            if ((var6.a & 255) == var1 && var0 < var6.c.length) {
               return var6.c[var0];
            }
         }
      }

      return -1;
   }

   public boolean x() {
      return this.N;
   }

   public void c(boolean var1) {
      this.N = var1;
   }

   public void d(boolean var1) {
      this.O = var1;
   }

   public int y() {
      return this.h;
   }

   public boolean z() {
      return this.L;
   }

   public void e(boolean var1) {
      this.L = var1;
   }
}
